package com.ruoyi.lm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.lm.mapper.LmLevelpackageMapper;
import com.ruoyi.lm.domain.LmLevelpackage;
import com.ruoyi.lm.service.ILmLevelpackageService;
import com.ruoyi.common.core.text.Convert;

/**
 * 会员套餐包Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-09-02
 */
@Service
public class LmLevelpackageServiceImpl implements ILmLevelpackageService 
{
    @Autowired
    private LmLevelpackageMapper lmLevelpackageMapper;

    /**
     * 查询会员套餐包
     * 
     * @param id 会员套餐包ID
     * @return 会员套餐包
     */
    @Override
    public LmLevelpackage selectLmLevelpackageById(String id)
    {
        return lmLevelpackageMapper.selectLmLevelpackageById(id);
    }

    /**
     * 查询会员套餐包列表
     * 
     * @param lmLevelpackage 会员套餐包
     * @return 会员套餐包
     */
    @Override
    public List<LmLevelpackage> selectLmLevelpackageList(LmLevelpackage lmLevelpackage)
    {
        return lmLevelpackageMapper.selectLmLevelpackageList(lmLevelpackage);
    }

    /**
     * 新增会员套餐包
     * 
     * @param lmLevelpackage 会员套餐包
     * @return 结果
     */
    @Override
    public int insertLmLevelpackage(LmLevelpackage lmLevelpackage)
    {
        lmLevelpackage.setId(IdWorker.getId());
        lmLevelpackage.setCreateTime(DateUtils.getNowDate());
        return lmLevelpackageMapper.insertLmLevelpackage(lmLevelpackage);
    }

    /**
     * 修改会员套餐包
     * 
     * @param lmLevelpackage 会员套餐包
     * @return 结果
     */
    @Override
    public int updateLmLevelpackage(LmLevelpackage lmLevelpackage)
    {
        lmLevelpackage.setUpdateTime(DateUtils.getNowDate());
        return lmLevelpackageMapper.updateLmLevelpackage(lmLevelpackage);
    }

    /**
     * 删除会员套餐包对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLmLevelpackageByIds(String ids)
    {
        return lmLevelpackageMapper.deleteLmLevelpackageByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除会员套餐包信息
     * 
     * @param id 会员套餐包ID
     * @return 结果
     */
    @Override
    public int deleteLmLevelpackageById(String id)
    {
        return lmLevelpackageMapper.deleteLmLevelpackageById(id);
    }
}
